<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/



//home首页
Route::get('/', 'Home\IndexController@index');



require_once app_path('Http/Route').'/admin.php';
require_once app_path('Http/Route').'/shaZhongHai.php';


//登录注册路由
// 认证路由...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
//商家登录
Route::post('/shopLogin','Admin\ShopLoginController@postLogin');
// 注册路由...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

Route::get('test', 'TestController@index');

//商品列表页
Route::resource('cat','Home\CatController');
//商品详情
Route::resource('goods','Home\GoodsController');
//店铺展示
//按价格排序
Route::get('shop/sortPrice/{id}','Home\ShopController@sortPrice');
Route::resource('shop','Home\ShopController');






//用户登录控制路由组
Route::group(['middleware'=>'Home.user'],function(){

	//购物车
	Route::resource('cart','Home\CartController');
	//添加商品到购物车
	Route::get('addCart/{gid}/{num?}/{size?}','Home\CartController@addCart');
	//清空购物车
	Route::get('delcart','Home\CartController@delCart');
	//移除购物车中产品
	Route::get('removeItem/{rowId}','Home\CartController@removeItem');
	//订单显示路由
	Route::get('showpay','Home\OrderController@index');

	//订单生成路由
	Route::get('pay/{address_id}','Home\OrderController@createOrder');

	//前台查看订单路由
	Route::get('orderInfo','Home\OrderController@showOrder');	

	//前台用户删除订单路由
	Route::get('orderDel/{order_num}/{goods_id}','Home\OrderController@OrderDel');


	//个人中心
	Route::resource('person','Home\PersonController');
	//个人信息
	Route::resource('personinfo','Home\PersoninfoController');
	//收货地址路由
	Route::resource('address','Home\AddressController');
	//保存地址
	Route::get('addr','Home\AddressController@store');
	//地址状态
	Route::get('addrstatus','Home\AddressController@status');
	//地址删除
	Route::get('addrdel/{id}','Home\AddressController@destroy');
	//密码修改
	Route::resource('password','Home\PasswordController');
	//邮箱
	Route::get('mail','Home\MailController@send');
	//安全设置
	Route::resource('safety','Home\SafetyController');
	//验证方法
	Route::get('checkmail','Home\MailController@getCode');


	//前台评价添加
	Route::get('assess/{goods_id}/{id}','Home\AssessController@index');	
	//前台评价
	Route::resource('assess','Home\AssessController');

	//确认收货路由
	Route::get('getGoods/{goods_id}/{id}','Home\OrderController@getGoods');

	//个人中心跳转付款界面
	Route::get('dopay/{order_num}/{goods_id}','Home\OrderController@doPay');

	//确认付款路由
	Route::post('/pay_confirm','Home\OrderController@payConfirm');



	//个人中心
	Route::resource('person','Home\PersonController');
	//个人信息
	Route::resource('personinfo','Home\PersoninfoController');
	//收货地址路由
	Route::resource('address','Home\AddressController');
	//保存地址
	Route::get('addr','Home\AddressController@store');

	//支付成功跳转路由
	Route::get('/success/{order_num}/{goods_id?}','Home\OrderController@successPay');

	//用户申请退款路由
	Route::resource('refund','Home\OrderController');

	//前台查看用户退货列表路由
	Route::get('refundList','Home\OrderController@showRefund');

});


//商家登录控制路由组
Route::group(['middleware'=>'Home.shop'],function(){
	//商家查看订单列表
	Route::get('shopOrder','Admin\OrderController@index');

	//商家发货路由
	Route::get('orderSend/{order_num}/{goods_id}','Admin\OrderController@orderSend');

	//商家查看退款订单路由
	Route::get('showRefund','Admin\OrderController@showRefund');

	//商家退款操作
	Route::get('doRefund/{order_num}/{order_id}','Admin\OrderController@doRefund');

	//商家注销登录
	Route::get('/shopLogout','Admin\ShopLoginController@shopLogout');


	//商家修改店铺信息
	Route::resource('shopInfo','Home\ShopInfoController');
});

